const { Article } = require('../../model/article');
const { Comment } = require('../../model/comment');
const pagenation = require('mongoose-sex-page');
module.exports = async(req, res) => {
    let article = await Article.findOne({ _id: req.query.id }).populate('author');
    let comments = await Comment.find({ aid: req.query.id }).populate('uid');
    console.log(article);
    console.log(comments);
    res.render('home/article', {
        article: JSON.parse(JSON.stringify(article)),
        comments: JSON.parse(JSON.stringify(comments))
    });
}